package com.data.bobostructure.entity;

import java.util.Comparator;

/**
 * Created by wangbing on 2018/3/15.
 */
public class Student implements Comparable<Student> {
    private String name;
    private int score;
    private int age;

    public Student(String name, int score, int age) {
        this.name = name;
        this.score = score;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }





    public int compareTo(Student s) {
        if (s.getScore()<this.getScore()){
            return 1;
        }
        else if (s.getScore()<this.getScore()){
            return -1;
        }
        return 0;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", score=" + score +
                ", age=" + age +
                '}';
    }
}
